/*
 * ConfigurationManager.cpp
 *
 *  Created on: Oct 20, 2012
 *      Author: johnny
 */

#include "ConfigurationManager.h"
#include "Engine.h"

namespace core {

ConfigurationManager& ConfigurationManager::getInstance() {
	static ConfigurationManager cfgMngr;
	return cfgMngr;
}

ConfigurationManager::ConfigurationManager(): connHandler() {
}

ConfigurationManager::~ConfigurationManager() {
}

bool ConfigurationManager::loadCfg(std::string cfg) {

	return true;
}

void ConfigurationManager::addMO(boost::shared_ptr<measurement::MeasBase> mo) {
    connHandler.connect(mo);
    loadedMOs.push_back(mo);

    mo->setMeasIndex(Engine::getInstance().generateHandle());
    mo->init();
}

void ConfigurationManager::removeMO(boost::shared_ptr<measurement::MeasBase> mo) {
    connHandler.disconnect(mo);
    loadedMOs.remove(mo);
}

const std::list< boost::shared_ptr<measurement::MeasBase> >& ConfigurationManager::getLoadedMOs() {
    return loadedMOs;
}

MeasConnectionHandler& ConfigurationManager::getMeasConnHandler() {
    return connHandler;
}

} /* namespace core */
